﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CCSSystem
{
    public sealed class HouseQueryCmd : BaseCommand
    {

        private SharpMap.Forms.MapImage m_pMapImage;
        private System.Windows.Forms.Form m_pMainForm;

        //private ESRI.ArcGIS.Geodatabase.ISpatialFilter m_pSpFilter;
        public HouseQueryCmd()
        {
            base.m_caption = "楼盘信息查询";
            //base.m_category = "RPISQuery";
            //base.m_message = "楼盘信息查询";
            base.m_name = "HouseQueryCmd";
            base.m_toolTip = "楼盘信息查询";
        }

        public override void OnCreate(object hook)
        {


            m_pMainForm = (Form)hook;
            SplitContainer pSplitContainer;
            //得到MapControl
            for (int i = 0; i <= m_pMainForm.Controls.Count - 1; i++)
            {
                if (m_pMainForm.Controls[i].Name == "splitContainer1")
                {
                    pSplitContainer = (SplitContainer)m_pMainForm.Controls[i];
                    for (int l = 0; l <= pSplitContainer.Panel2.Controls.Count - 1; l++)
                    {
                        if (pSplitContainer.Panel2.Controls[l].Name == "mcMainMap")
                        {
                            m_pMapImage = (SharpMap.Forms.MapImage)pSplitContainer.Panel2.Controls[l];
                            break;
                        }
                    }

                    break;
                }

            }
        }


        public override void OnClick()
        {

            base.OnClick();
            HouseQueryForm m_frmHouseQueryForm = new HouseQueryForm();
            m_frmHouseQueryForm.m_pMainForm = m_pMainForm;
            m_frmHouseQueryForm.m_pMapImage = m_pMapImage;
            m_frmHouseQueryForm.ShowDialog();

        }


    }
}
